package cn.yonyong.base.project.quartz;

import cn.yonyong.base.project.BaseTest;
import org.junit.Test;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Describtion spring 自带quartz 使用
 * @Author yonyong
 * @Date 2019/9/6 16:16
 * @Version 1.0.0
 **/
//@Component
public class UseQuartz extends BaseTest{

    @Test
    @Scheduled(cron = "0/5 * * * * ? ")
    public void printCurrentTime() {
        System.out.println();
        System.out.println("任务调度-----Current Time is:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
    }
}
